/*
 * @Author: your name
 * @Date: 2020-09-12 09:30:16
 * @LastEditTime: 2020-09-19 14:28:21
 * @LastEditors: zhengzhuang
 * @Description: In User Settings Edit
 * @FilePath: /C20Driver/lib/widget/qr_capture.dart
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
// import 'package:qrcode/qrcode.dart';

class QRCapturePage extends StatefulWidget {
  @override
  _QRCapturePageState createState() => _QRCapturePageState();
}

class _QRCapturePageState extends State<QRCapturePage> {
  // QRCaptureController _captureController = QRCaptureController();
  bool _isTorchOn = false;

  @override
  void initState() {
    super.initState();

    //   _captureController.onCapture((data) {
    //     _captureController.pause();
    //     print('onCapture----$data');
    //   });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '扫一扫',
        ),
      ),
      body: Stack(
        alignment: Alignment.center,
        children: <Widget>[
          // QRCaptureView(controller: _captureController),
          // Align(
          //   alignment: Alignment.bottomCenter,
          //   child: _buildToolBar(),
          // )
        ],
      ),
    );
  }

  // Widget _buildToolBar() {
  //   return Row(
  //         mainAxisSize: MainAxisSize.max,
  //         mainAxisAlignment: MainAxisAlignment.center,
  //         children: <Widget>[
  //           FlatButton(
  //             onPressed: () {
  //               _captureController.pause();
  //             },
  //             child: Text('pause'),
  //           ),
  //           FlatButton(
  //             onPressed: () {
  //               if (_isTorchOn) {
  //                 _captureController.torchMode = CaptureTorchMode.off;
  //               } else {
  //                 _captureController.torchMode = CaptureTorchMode.on;
  //               }
  //               _isTorchOn = !_isTorchOn;
  //             },
  //             child: Text('torch'),
  //           ),
  //           FlatButton(
  //             onPressed: () {
  //               _captureController.resume();
  //             },
  //             child: Text('resume'),
  //           ),
  //         ],
  //       );
  // }
}
